import pymysql

print("init")

db = pymysql.connect(host='127.0.0.1', user='root', password='997968284', database='flaskdb')
cursor = db.cursor()  # 使用 cursor() 方法创建一个游标对象 cursor
sql1 = "CREATE TABLE IF not EXISTS user_register " \
      "(user_id  CHAR(15) UNIQUE," \
      "user_name  VARCHAR (20) UNIQUE," \
      "pw_phone  VARCHAR(11)," \
      "pw_email  VARCHAR(20)," \
      "password VARCHAR(20) NOT NULL)"
cursor.execute(sql1)  # 执行sql语句,创建注册表
db.close()  # 关闭数据库连接
